<script setup lang="ts">
import { onUnmounted } from 'vue'
import { useCounterStore } from '@/stores/modules/countStore' // 需要先创建pinia store
import XtxGuess from '@/components/XtxGuess.vue'
import { useguess } from '@/hooks/useGuessProduct'
import { onLoad, onReady } from '@dcloudio/uni-app'
import { ref, computed } from 'vue'
import { BaseUrl } from '@/utils/request'
import { formatDate } from '@/utils/formatDate'
import type { addressType } from '@/types/settings'
import { getAddressDetailApi } from '@/services/settingApi'
import type { order_list_type, physical_distribution_item } from '@/types/order'
import { cancelOrderApi, get_order_infoApi } from '@/services/orderApi'
import { getPayMiniPayApi } from '@/services/payApi'
import { deleteOrderApi, updateOrderApi } from '@/services/orderApi'

// 获取屏幕边界到安全区域距离
const { safeAreaInsets } = uni.getSystemInfoSync()
// 倒计时
const counterStore = useCounterStore()
// 计算总价格
const total_price = computed(() => {
  let total = 0
  orderInfoList.value.forEach((item) => {
    total += (item.num * (item.actual_payment * 100) + item.freight * 100) / 100
  })
  return total
})
const deleteOrder = async (order_number: string) => {
  const res = await deleteOrderApi(order_number)
  if (res.code === 200) {
    uni.showToast({
      title: '删除成功',
      icon: 'success',
      // 当设置为true时，用户无法点击页面其他部分，直到提示框消失。
      mask: true,
    })
  } else {
    uni.showToast({
      title: '删除失败',
      icon: 'error',
    })
  }
}
// 计算运费
const total_freight = computed(() => {
  let total = 0
  orderInfoList.value.forEach((item) => {
    total += item.freight * 100
  })
  return total / 100
})

// 计算商品总价格
const goods_total_price = computed(() => {
  let total = 0
  orderInfoList.value.forEach((item) => {
    total += (item.num * (item.actual_payment * 100)) / 100
  })
  return total
})
// 猜你喜欢
const guess = useguess()
// 弹出层组件
const popup = ref<UniHelper.UniPopupInstance>()
// 取消原因列表
const reasonList = ref([
  '商品无货',
  '不想要了',
  '商品信息填错了',
  '地址信息填写错误',
  '商品降价',
  '其它',
])
const order_state = ref([
  { text: '' },
  { text: '待支付' },
  { text: '待发货' },
  { text: '待收货' },
  { text: '待评价' },
  { text: '已完成' },
  { text: '已取消' },
])
const addressDetail = ref<addressType>({} as addressType)
const real_order_list = ref<order_list_type[]>([])
const orderInfoList = ref<order_list_type[]>({} as order_list_type[])

// 订单取消原因
const reason = ref('')
// 复制内容
const onCopy = (id: string) => {
  // 设置系统剪贴板的内容
  uni.setClipboardData({ data: id })
}
// 获取页面参数
const params = defineProps<{
  order_number: string
}>()
// 获取地址详细信息
const get_address_detail = async (id: number) => {
  const res = await getAddressDetailApi(id)
  if (res.code === 200) {
    addressDetail.value = res.data!
    console.log('获取到地址信息')
    console.log(addressDetail.value)
  }
}
const get_order_info_list = async () => {
  const res = await get_order_infoApi(params.order_number)
  if (res.code === 200) {
    orderInfoList.value = res.data!
  }
}
// 弹窗所用数据
// 物流公司名称
const logisticsPopup = ref<UniHelper.UniPopupInstance>()
// 物流信息列表
const presentGoods = ref<order_list_type>({} as order_list_type)
const open_logistics = (item: order_list_type) => {
  if (item.phy.length === 0) {
    uni.showToast({
      icon: 'none',
      title: '暂无物流信息',
    })
  }
  presentGoods.value = { ...item }
  console.log(presentGoods.value)
  logisticsPopup.value?.open?.()
}
const onScrolltolower = () => {}
const closeLogisticsPopup = () => {
  logisticsPopup.value?.close?.()
}
onLoad(async () => {
  await get_order_info_list()
  await get_address_detail(orderInfoList.value[0].address)
  // 初始化或恢复倒计时
  counterStore.initCountdown(params.order_number, 10 * 60)
})
// 获取页面栈
const pages = getCurrentPages()
// 获取当前页面实例,没有这个类型,需要自己定义，直接使用any处理
const currentPage = pages.at(-1) as any
// 小程序滚动驱动动画
onReady(() => {
  currentPage?.animate(
    '.navbar',
    [
      {
        // 初始样式
        backgroundColor: 'transparent',
      },
      {
        // 结束样式
        backgroundColor: '#f8f8f8',
      },
    ],
    1000,
    {
      scrollSource: '#scroller',
      timeRange: 2000,
      // 滚动到 0 时开始动画
      startScrollOffset: 0,
      // 滚动到 50 时结束动画
      endScrollOffset: 50,
    },
  )
  currentPage?.animate(
    '.navbar .title',
    [
      {
        // 初始样式
        color: 'transparent',
      },
      {
        // 结束样式
        color: '#000',
      },
    ],
    1000,
    {
      // transparent是一个特殊颜色值，表示完全透明的黑色（等同于rgba(0, 0, 0, 0)）
      scrollSource: '#scroller',
      timeRange: 2000,
      // 滚动到 0 时开始动画
      startScrollOffset: 0,
      // 滚动到 50 时结束动画
      endScrollOffset: 50,
    },
  )
  currentPage?.animate(
    '.navbar .back',
    [
      {
        // 初始样式
        color: '#fff',
      },
      {
        // 结束样式
        color: '#000',
      },
    ],
    1000,
    {
      // transparent是一个特殊颜色值，表示完全透明的黑色（等同于rgba(0, 0, 0, 0)）
      scrollSource: '#scroller',
      timeRange: 2000,
      // 滚动到 0 时开始动画
      startScrollOffset: 0,
      // 滚动到 50 时结束动画
      endScrollOffset: 50,
    },
  )
})
// 页面卸载时保持计时器运行
onUnmounted(() => {
  counterStore.persistCountdown(params.order_number)
})
const handleDelete = async (order_number: string) => {
  const res = await deleteOrder(order_number)
  counterStore.clearCountdown(order_number)
  // 去订单列表页
  uni.redirectTo({ url: '/pages/order/components/orderList?type=0' })
}
const handlePay = async (order_number: string) => {
  // 调用支付接口
  const res = await getPayMiniPayApi(order_number)
  if (import.meta.env.DEV) {
    const payresult = await updateOrderApi(order_number)
    if (payresult.code === 200) {
      uni.navigateTo({
        url: `/pages/order/components/payment?id=${order_number}`,
      })
    }
  } else {
    wx.requestPayment(res.data!)
  }
}
const handleCanalOrder = async (order_number: string) => {
  const res = await cancelOrderApi(order_number)
  if (res.code === 200) {
    uni.redirectTo({
      url: '/pages/order/components/orderList?type=0',
    })
  }
}
</script>

<template>
  <!-- 自定义导航栏: 默认透明不可见, scroll-view 滚动到 50 时展示 -->
  <view class="navbar" :style="{ paddingTop: safeAreaInsets?.top + 'px' }">
    <view class="wrap">
      <navigator open-type="navigateBack" class="back icon-left"></navigator>
      <view class="title">订单详情</view>
    </view>
  </view>
  <scroll-view scroll-y class="viewport" id="scroller" @scrolltolower="onScrolltolower">
    <template v-if="orderInfoList.length > 0">
      <!-- 订单状态 -->
      <view class="overview" :style="{ paddingTop: safeAreaInsets!.top + 20 + 'px' }">
        <!-- 待付款状态:展示去支付按钮和倒计时 -->
        <template v-if="orderInfoList[0].order_of_payment === 1">
          <view class="status icon-clock">等待付款</view>
          <view class="tips">
            <text class="money">应付金额: ¥ {{ total_price }}</text>
            <text class="time">支付剩余</text>
            <uni-countdown
              :second="counterStore.getRemainingSeconds(params.order_number)"
              color="#FFFFFF"
              :showDay="false"
              :showHour="false"
              splitorColor="#fff"
            ></uni-countdown>
          </view>
          <view class="button" @tap.stop="handlePay(orderInfoList[0]!.order_number!)">去支付</view>
        </template>
        <!-- 其他订单状态:展示再次购买按钮 -->
        <template v-else>
          <!-- 订单状态文字 -->
          <view class="status"> {{ order_state[orderInfoList[0].order_of_payment].text }} </view>
          <view class="button-group">
            <navigator
              class="button"
              :url="`/pages/order/order?order_number=${params.order_number}`"
              hover-class="none"
            >
              再次购买
            </navigator>
            <!-- 待发货状态：模拟发货,开发期间使用,用于修改订单状态为已发货 -->
            <view v-if="false" class="button"> 模拟发货 </view>
          </view>
        </template>
      </view>
      <!-- 配送状态 -->
      <view class="shipment">
        <!-- 订单物流信息 -->

        <!-- 用户收货地址 -->
        <view class="locate">
          <view class="user"> {{ addressDetail.name }} {{ addressDetail.telephone }} </view>
          <view class="address">
            {{ addressDetail.province }} {{ addressDetail.city }} {{ addressDetail.district
            }}{{ addressDetail.address }}
          </view>
        </view>
      </view>

      <!-- 商品信息 -->
      <view class="goods">
        <view class="item">
          <navigator
            class="navigator"
            v-for="item in orderInfoList"
            :key="item.id"
            :url="`/pages/goods/goods?id=${item.sku_info.product}`"
            hover-class="none"
          >
            <image
              class="cover"
              src="https://yanxuan-item.nosdn.127.net/c07edde1047fa1bd0b795bed136c2bb2.jpg"
            ></image>
            <view class="meta">
              <view class="name ellipsis">{{ item.sku_info.goods_name }}</view>
              <view class="type">{{ item.sku_info.sku_name_arr }}</view>
              <view class="price">
                <view class="actual">
                  <text class="symbol">¥</text>
                  <text>{{ item.actual_payment }}</text>
                </view>
              </view>
              <view class="quantity">x1</view>
            </view>
            <button
              hover-class="button-hover"
              v-if="
                item.order_of_payment === 2 ||
                item.order_of_payment === 3 ||
                item.order_of_payment === 4
              "
              @tap.stop="open_logistics(item)"
              class="logistics"
            >
              查看物流
            </button>
          </navigator>
          <!-- 待评价状态:展示按钮 -->
          <view class="action" v-if="orderInfoList[0].order_of_payment === 4">
            <view class="button primary">申请售后</view>
            <navigator url="" class="button"> 去评价 </navigator>
          </view>
        </view>
        <!-- 合计 -->
        <view class="total">
          <view class="row">
            <view class="text">商品总价: </view>
            <view class="symbol">{{ goods_total_price }}</view>
          </view>
          <view class="row">
            <view class="text">运费: </view>
            <view class="symbol">{{ total_freight }}</view>
          </view>
          <view class="row">
            <view class="text">应付金额: </view>
            <view class="symbol primary">{{ total_price }}</view>
          </view>
        </view>
      </view>

      <!-- 订单信息 -->
      <view class="detail">
        <view class="title">订单信息</view>
        <view class="row">
          <view class="item">
            订单编号: {{ orderInfoList[0].order_number }}
            <text class="copy" @tap="onCopy(orderInfoList[0].order_number)">复制</text>
          </view>
          <view class="item">下单时间: {{ formatDate(orderInfoList[0].created_time) }}</view>
        </view>
      </view>

      <!-- 猜你喜欢 -->
      <!-- <XtxGuess ref="guessRef" /> -->

      <!-- 底部操作栏 -->
      <view class="toolbar-height" :style="{ paddingBottom: safeAreaInsets?.bottom + 'px' }"></view>
      <view class="toolbar" :style="{ paddingBottom: safeAreaInsets?.bottom + 'px' }">
        <!-- 待付款状态:展示支付按钮 -->
        <template v-if="orderInfoList[0].order_of_payment === 1">
          <view class="button primary" @tap="handlePay(orderInfoList[0]!.order_number!)">
            去支付
          </view>
          <view class="button" @tap="popup?.open?.()"> 取消订单 </view>
        </template>
        <!-- 其他订单状态:按需展示按钮 -->
        <template v-else>
          <navigator
            class="button secondary"
            :url="`/pagesOrder/create/create?orderId=${params.order_number}`"
            hover-class="none"
          >
            再次购买
          </navigator>
          <!-- 待收货状态: 展示确认收货 -->
          <view class="button primary"> 确认收货 </view>
          <!-- 待评价状态: 展示去评价 -->
          <view class="button"> 去评价 </view>
          <!-- 待评价/已完成/已取消 状态: 展示删除订单 -->
          <view class="button delete" @tap="deleteOrder(orderInfoList[0].order_number)">
            删除订单
          </view>
        </template>
      </view>
    </template>
    <template v-else>
      <!-- 骨架屏组件 -->
      <PageSkeleton />
    </template>
  </scroll-view>
  <!-- 取消订单弹窗 -->
  <uni-popup ref="popup" type="bottom" background-color="#fff" v-if="presentGoods">
    <view class="popup-root">
      <view class="title">订单取消</view>
      <view class="description">
        <view class="tips">请选择取消订单的原因：</view>
        <view class="cell" v-for="item in reasonList" :key="item" @tap="reason = item">
          <text class="text">{{ item }}</text>
          <text class="icon" :class="{ checked: item === reason }"></text>
        </view>
      </view>
      <view class="footer">
        <view class="button" @tap="popup?.close?.()">取消</view>
        <view class="button primary" @tap="handleCanalOrder(orderInfoList[0]!.order_number!)"
          >确认</view
        >
      </view>
    </view>
  </uni-popup>
  <uni-popup ref="logisticsPopup" type="bottom" background-color="#fff">
    <view class="bh-logistics-popup">
      <!-- 头部 -->
      <view class="bh-logistics-headerr">
        <text class="bh-logistics-title">物流详情</text>
        <text class="iconfont icon-close" @tap="closeLogisticsPopup"></text>
      </view>

      <!-- 商品信息 -->
      <view class="bh-logistics-goods-card">
        <image class="bh-logistics-goods-img" :src="BaseUrl + presentGoods?.sku_info?.image" />
        <view class="bh-goods-info">
          <text class="bh-goods-name">{{ presentGoods?.sku_info?.goods_name }}</text>
          <text class="bh-goods-spec">{{ presentGoods?.sku_info?.sku_name_arr?.join(' ') }}</text>
        </view>
      </view>

      <!-- 物流信息 -->
      <view class="bh-logistics-info">
        <view class="bh-logistics-info-item">
          <text>物流公司：</text>
          <text>{{ presentGoods?.delivery_company }}</text>
        </view>
        <view class="bh-logistics-info-item">
          <text>运单编号：</text>
          <text>{{ presentGoods?.delivery_number }}</text>
        </view>
      </view>

      <!-- 时间轴 -->
      <scroll-view scroll-y class="bh-timeline">
        <!-- 添加时间轴分隔线 -->
        <view class="bh-timeline-divider"></view>
        <view v-for="(item, index) in presentGoods?.phy" :key="index" class="bh-timeline-item">
          <view class="bh-timeline-dot"></view>
          <view class="bh-timeline-content">
            <text class="bh-timeline-time">{{ formatDate(item.time) }}</text>
            <text class="bh-timeline-status">{{ item.text }}</text>
          </view>
        </view>
      </scroll-view>
    </view>
  </uni-popup>
</template>

<style lang="scss">
page {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.navbar {
  width: 750rpx;
  color: #000;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 9;
  /* background-color: #f8f8f8; */
  background-color: transparent;

  .wrap {
    position: relative;

    .title {
      height: 44px;
      display: flex;
      justify-content: center;
      align-items: center;
      font-size: 32rpx;
      /* color: #000; */
      color: transparent;
    }

    .back {
      position: absolute;
      left: 0;
      height: 44px;
      width: 44px;
      font-size: 44rpx;
      display: flex;
      align-items: center;
      justify-content: center;
      /* color: #000; */
      color: #fff;
    }
  }
}

.viewport {
  background-color: #f7f7f8;
}

.overview {
  display: flex;
  flex-direction: column;
  align-items: center;

  line-height: 1;
  padding-bottom: 30rpx;
  color: #fff;
  background-image: url(https://pcapi-xiaotuxian-front-devtest.itheima.net/miniapp/images/order_bg.png);
  background-size: cover;

  .status {
    font-size: 36rpx;
  }

  .status::before {
    margin-right: 6rpx;
    font-weight: 500;
  }

  .tips {
    margin: 30rpx 0;
    display: flex;
    font-size: 14px;
    align-items: center;

    .money {
      margin-right: 30rpx;
    }
  }

  .button-group {
    margin-top: 30rpx;
    display: flex;
    justify-content: center;
    align-items: center;
  }

  .button {
    width: 260rpx;
    height: 64rpx;
    margin: 0 10rpx;
    text-align: center;
    line-height: 64rpx;
    font-size: 28rpx;
    color: #27ba9b;
    border-radius: 68rpx;
    background-color: #fff;
  }
}

.shipment {
  line-height: 1.4;
  padding: 0 20rpx;
  margin: 20rpx 20rpx 0;
  border-radius: 10rpx;
  background-color: #fff;

  .locate,
  .item {
    min-height: 120rpx;
    padding: 30rpx 30rpx 25rpx 75rpx;
    background-size: 50rpx;
    background-repeat: no-repeat;
    background-position: 6rpx center;
  }

  .locate {
    background-image: url(https://pcapi-xiaotuxian-front-devtest.itheima.net/miniapp/images/locate.png);

    .user {
      font-size: 26rpx;
      color: #444;
    }

    .address {
      font-size: 24rpx;
      color: #666;
    }
  }

  .item {
    background-image: url(https://pcapi-xiaotuxian-front-devtest.itheima.net/miniapp/images/car.png);
    border-bottom: 1rpx solid #eee;
    position: relative;

    .message {
      font-size: 26rpx;
      color: #444;
    }

    .date {
      font-size: 24rpx;
      color: #666;
    }
  }
}

.goods {
  margin: 20rpx 20rpx 0;
  padding: 0 20rpx;
  border-radius: 10rpx;
  background-color: #fff;

  .item {
    padding: 30rpx 0;
    border-bottom: 1rpx solid #eee;

    .navigator {
      display: flex;
      margin: 20rpx 0;
    }

    .cover {
      width: 170rpx;
      height: 170rpx;
      border-radius: 10rpx;
      margin-right: 20rpx;
    }

    .meta {
      flex: 1;
      display: flex;
      flex-direction: column;
      justify-content: center;
      position: relative;
    }

    .name {
      height: 80rpx;
      font-size: 26rpx;
      color: #444;
    }

    .type {
      line-height: 1.8;
      padding: 0 15rpx;
      margin-top: 6rpx;
      font-size: 24rpx;
      align-self: flex-start;
      border-radius: 4rpx;
      color: #888;
      background-color: #f7f7f8;
    }

    .price {
      display: flex;
      margin-top: 6rpx;
      font-size: 24rpx;
    }

    .symbol {
      font-size: 20rpx;
    }

    .original {
      color: #999;
      text-decoration: line-through;
    }

    .actual {
      margin-left: 10rpx;
      color: #444;
    }

    .text {
      font-size: 22rpx;
    }

    .quantity {
      position: absolute;
      bottom: 0;
      right: 0;
      font-size: 24rpx;
      color: #444;
    }

    .action {
      display: flex;
      flex-direction: row-reverse;
      justify-content: flex-start;
      padding: 30rpx 0 0;

      .button {
        width: 200rpx;
        height: 60rpx;
        text-align: center;
        justify-content: center;
        line-height: 60rpx;
        margin-left: 20rpx;
        border-radius: 60rpx;
        border: 1rpx solid #ccc;
        font-size: 26rpx;
        color: #444;
      }

      .primary {
        color: #27ba9b;
        border-color: #27ba9b;
      }
    }
  }

  .total {
    line-height: 1;
    font-size: 26rpx;
    padding: 20rpx 0;
    color: #666;

    .row {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 10rpx 0;
    }

    .symbol::before {
      content: '¥';
      font-size: 80%;
      margin-right: 3rpx;
    }

    .primary {
      color: #cf4444;
      font-size: 36rpx;
    }
  }
}

.detail {
  line-height: 1;
  padding: 30rpx 20rpx 0;
  margin: 20rpx 20rpx 0;
  font-size: 26rpx;
  color: #666;
  border-radius: 10rpx;
  background-color: #fff;

  .title {
    font-size: 30rpx;
    color: #444;
  }

  .row {
    padding: 20rpx 0;

    .item {
      padding: 10rpx 0;
      display: flex;
      align-items: center;
    }

    .copy {
      border-radius: 20rpx;
      font-size: 20rpx;
      border: 1px solid #ccc;
      padding: 5rpx 10rpx;
      margin-left: 10rpx;
    }
  }
}

.toolbar-height {
  height: 100rpx;
  box-sizing: content-box;
}

.toolbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(var(--window-bottom));
  z-index: 1;

  height: 100rpx;
  padding: 0 20rpx;
  display: flex;
  align-items: center;
  flex-direction: row-reverse;
  border-top: 1rpx solid #ededed;
  border-bottom: 1rpx solid #ededed;
  background-color: #fff;
  box-sizing: content-box;

  .button {
    display: flex;
    justify-content: center;
    align-items: center;

    width: 200rpx;
    height: 72rpx;
    margin-left: 15rpx;
    font-size: 26rpx;
    border-radius: 72rpx;
    border: 1rpx solid #ccc;
    color: #444;
  }

  .delete {
    order: 4;
  }

  .button {
    order: 3;
  }

  .secondary {
    order: 2;
    color: #27ba9b;
    border-color: #27ba9b;
  }

  .primary {
    order: 1;
    color: #fff;
    background-color: #27ba9b;
  }
}

.popup-root {
  padding: 30rpx 30rpx 0;
  border-radius: 10rpx 10rpx 0 0;
  overflow: hidden;

  .title {
    font-size: 30rpx;
    text-align: center;
    margin-bottom: 30rpx;
  }

  .description {
    font-size: 28rpx;
    padding: 0 20rpx;

    .tips {
      color: #444;
      margin-bottom: 12rpx;
    }

    .cell {
      display: flex;
      justify-content: space-between;
      align-items: center;
      padding: 15rpx 0;
      color: #666;
    }

    .icon::before {
      content: '\e6cd';
      font-family: 'erabbit' !important;
      font-size: 38rpx;
      color: #999;
    }

    .icon.checked::before {
      content: '\e6cc';
      font-size: 38rpx;
      color: #27ba9b;
    }
  }

  .footer {
    display: flex;
    justify-content: space-between;
    padding: 30rpx 0 40rpx;
    font-size: 28rpx;
    color: #444;

    .button {
      flex: 1;
      height: 72rpx;
      text-align: center;
      line-height: 72rpx;
      margin: 0 20rpx;
      color: #444;
      border-radius: 72rpx;
      border: 1rpx solid #ccc;
    }

    .primary {
      color: #fff;
      background-color: #27ba9b;
      border: none;
    }
  }
}
.navigator {
  display: flex !important;
  align-items: center;
  .logistics {
    border-radius: 15rpx;
    height: 40rpx;
    width: 150rpx;
    font-size: 20rpx;
    color: #666;
    display: flex;
    align-items: center !important;
    justify-content: center;
  }
}
.bh-logistics-popup {
  display: flex;
  flex-direction: column;
  height: 80vh;
  padding: 32rpx;
  background: #fff;
}

/* 弹窗头部 */
.bh-logistics-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 24rpx 32rpx;
  border-bottom: 2rpx solid #eee;

  .bh-logistics-title {
    font-size: 36rpx;
    font-weight: 600;
    color: #333;
  }

  .icon-close {
    font-size: 40rpx;
    color: #999;
    padding: 16rpx;
  }
}

/* 商品卡片 */
.bh-logistics-goods-card {
  display: flex;
  align-items: center;
  margin: 32rpx 0;
  padding: 24rpx;
  background: #f8f8f8;
  border-radius: 16rpx;

  .bh-logistics-goods-img {
    width: 160rpx;
    height: 160rpx;
    border-radius: 8rpx;
    margin-right: 32rpx;
  }

  .bh-goods-info {
    flex: 1;

    .bh-goods-name {
      font-size: 28rpx;
      color: #333;
      line-height: 1.4;
      margin-bottom: 12rpx;
    }

    .bh-goods-spec {
      font-size: 24rpx;
      color: #666;
    }
  }
}

/* 物流信息 */
.bh-logistics-info {
  padding: 24rpx;
  margin-bottom: 32rpx;
  background: #f8f8f8;
  border-radius: 12rpx;

  &-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16rpx 0;
    font-size: 28rpx;

    text:first-child {
      color: #666;
    }

    text:last-child {
      color: #27ba9b;
      font-weight: 500;
    }
  }
}

/* 时间轴容器 */
.bh-logistics-timeline {
  flex: 1;
  position: relative;
  padding: 0 32rpx 32rpx;
}

.bh-timeline {
  height: 100%;
  overflow-y: auto;
  padding: 24rpx 0;

  &-item {
    position: relative;
    padding: 32rpx 0 32rpx 64rpx;
    margin-left: 48rpx;
    z-index: 1;

    &::before {
      content: '';
      position: absolute;
      left: -6rpx;
      top: 40rpx;
      width: 24rpx;
      height: 24rpx;
      background: #fff;
      border: 4rpx solid #27ba9b;
      border-radius: 50%;
      z-index: 2;
    }
  }

  &-content {
    background: #fff;
    padding: 24rpx;
    border-radius: 8rpx;
    box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.06);
  }

  &-time {
    font-size: 24rpx;
    color: #999;
    margin-bottom: 8rpx;
  }

  &-status {
    font-size: 28rpx;
    color: #27ba9b;
    font-weight: 500;
  }
}
.bh-logistics-headerr {
  box-sizing: border-box;
  display: flex;
  justify-content: space-between;
}
</style>
